//定义功能，计算出数组中指定元素出现的次数。**
//数组: int[] arr = {1,43,43,5,4,6,6,7,7,88,9,9,9,0,0,9};
//指定元素: int x = 9;
public class zy4 {
    public static void main(String[] args) {
        int[] arr = {1, 43, 43, 5, 4, 6, 6, 7, 7, 88, 9, 9, 9, 0, 0, 9};
        int x = 9;
        int cishu1 = cishu(arr, x);
        System.out.println("出现：" + cishu1 + "次");
    }

    private static int cishu(int[] arr, int x) {
        int a = 0;

        for (int i = 0; i < arr.length; i++) {
            if (x == arr[i]) {
                a++;
            }
        }
        return a;
    }
}
